using Godot;
using System;

public partial class Play : CharacterBody2D
{
	[Export] int speed = 100;
	public Node2D graphic;
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
	{
		graphic = GetNode<Node2D>("Graphic");
    }

	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
		var direction = Input.GetVector("move_left", "move_right", "move_up", "move_down");
		if (direction != Vector2.Zero)
		{
			Velocity = direction.Normalized() * speed;
			MoveAndSlide();
		}
		else
		{
			Velocity = Vector2.Zero;
		}
		//if (direction.X < 0)
		//{
		//	graphic.Scale =new Vector2(1,0);
		//}
		//else
		//{
		//	graphic.Scale =new Vector2(-1,0);
  //      }
    }
}
